﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Collections.Generic;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;
    using WMS6.Web.CommonMethodServiceRef;

    public class InventoryQuery : BasePage
    {
        protected HtmlInputButton btnAction;
        protected Button btnAction2;
        protected HtmlInputReset btnClear;
        protected CheckBox cbxHistory;
        protected DropDownList ddlExpiryDate;
        protected DropDownList ddlExternalLot;
        protected DropDownList ddlLoaction;
        protected DropDownList ddlLotAttribute01;
        protected DropDownList ddlLotAttribute02;
        protected DropDownList ddlLotAttribute03;
        protected DropDownList ddlLotAttribute04;
        protected DropDownList ddlLotAttribute05;
        protected DropDownList ddlLotAttribute06;
        protected DropDownList ddlLotAttribute07;
        protected DropDownList ddlLotAttribute08;
        protected DropDownList ddlLotAttribute09;
        protected DropDownList ddlLotAttribute10;
        protected DropDownList ddlLotAttributeID;
        protected DropDownList ddlLpn;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlProductDate;
        protected DropDownList ddlQty;
        protected DropDownList ddlReceiptDate;
        protected DropDownList ddlSku;
        protected DropDownList ddlSkuClassIDOper;
        protected DropDownList ddlSkuDescrOper;
        protected DropDownList ddlSkuPropertyOper;
        protected DropDownList ddlVendorID;
        protected HtmlForm F5010;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlInputHidden hdnValue;
        protected HtmlImage img2;
        protected HtmlImage img3;
        protected HtmlImage img4;
        protected Label lblExpiryDate;
        protected Label lblExternalLot;
        protected Label lblLocation;
        protected Label lblLotAttribute02;
        protected Label lblLotAttribute03;
        protected Label lblLotAttribute04;
        protected Label lblLotAttribute05;
        protected Label lblLotAttribute06;
        protected Label lblLotAttribute07;
        protected Label lblLotAttribute08;
        protected Label lblLotAttribute09;
        protected Label lblLotAttribute1;
        protected Label lblLotAttribute10;
        protected Label lblLotAttributeID;
        protected Label lblLpn;
        protected Label lblMsg;
        protected Label lblOwner;
        protected Label lblOwnerID;
        protected Label lblProductDate;
        protected Label lblQty;
        protected Label lblReceiptDate;
        protected Label lblSku;
        protected Label lblSkuClassID;
        protected Label lblSkuDescr;
        protected Label lblSkuProperty;
        protected Label lblVendorID;
        protected MultipleSelectControl MSCSkuProperty;
        protected HtmlLink mycss;
        protected Label one1;
        protected Label one2;
        protected TextBox txtExpiryDate;
        protected TextBox txtExpiryDate2;
        protected TextBox txtExternalLot;
        protected TextBox txtLoaction;
        protected TextBox txtLotAttribute01;
        protected TextBox txtLotAttribute02;
        protected TextBox txtLotAttribute03;
        protected TextBox txtLotAttribute04;
        protected TextBox txtLotAttribute05;
        protected TextBox txtLotAttribute06;
        protected TextBox txtLotAttribute07;
        protected TextBox txtLotAttribute08;
        protected TextBox txtLotAttribute09;
        protected TextBox txtLotAttribute10;
        protected TextBox txtLotAttributeID;
        protected TextBox txtLpn;
        protected TextBox txtOwnerID;
        protected TextBox txtProductDate;
        protected TextBox txtProductDate2;
        protected TextBox txtQty;
        protected TextBox txtReceiptDate;
        protected TextBox txtReceiptDate2;
        protected TextBox txtSku;
        protected TextBox txtSkuClassID;
        protected TextBox txtSkuDescr;
        protected TextBox txtVendorID;

        protected void btnAction2_Click(object sender, EventArgs e)
        {
            string temp = "InventoryList.aspx?from=Query&Condition=" + base.UrlEncode(this.hdnValue.Value);
            base.Server.Transfer(temp);
        }

        private void InitDDl()
        {
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSku, 0);
            base.InitQueryDDL(this.ddlLotAttributeID, 0);
            base.InitQueryDDL(this.ddlLoaction, 0);
            base.InitQueryDDL(this.ddlLpn, 0);
            base.InitQueryDDL(this.ddlQty, 0);
            base.InitQueryDDL(this.ddlLotAttribute01, 0);
            base.InitQueryDDL(this.ddlLotAttribute02, 0);
            base.InitQueryDDL(this.ddlLotAttribute03, 0);
            base.InitQueryDDL(this.ddlLotAttribute04, 0);
            base.InitQueryDDL(this.ddlLotAttribute05, 0);
            base.InitQueryDDL(this.ddlLotAttribute06, 0);
            base.InitQueryDDL(this.ddlLotAttribute07, 0);
            base.InitQueryDDL(this.ddlLotAttribute08, 0);
            base.InitQueryDDL(this.ddlLotAttribute09, 0);
            base.InitQueryDDL(this.ddlLotAttribute10, 0);
            base.InitQueryDDL(this.ddlProductDate, 1);
            base.InitQueryDDL(this.ddlExpiryDate, 1);
            base.InitQueryDDL(this.ddlReceiptDate, 1);
            base.InitQueryDDL(this.ddlExternalLot, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlSkuPropertyOper, 0);
            this.ddlSkuPropertyOper.SelectedValue = "One Of";
            base.InitQueryDDL(this.ddlSkuDescrOper, 0);
            base.InitQueryDDL(this.ddlSkuClassIDOper, 0);
            List<LotAttributeCodeInfo> LotAttributeCode = CommoneMethodServiceClientProxy.GetInstance().GetLotAttributCodeByGroupID("货品属性");
            if ((LotAttributeCode != null) && (LotAttributeCode.Count > 0))
            {
                DropDownList ddlSkuProperty = new DropDownList {
                    DataSource = LotAttributeCode,
                    DataTextField = "DESCR",
                    DataValueField = "CODEID"
                };
                ddlSkuProperty.DataBind();
                this.MSCSkuProperty.ddlTempDropDownList = ddlSkuProperty;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDDl();
            }
        }

        public string ExpiryDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExpiryDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExpiryDate.Text.Trim(), this.ddlExpiryDate.SelectedValue, this.txtExpiryDate2.Text.Trim(), "ExpiryDate");
                }
                return "";
            }
        }

        public string ExternalLot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalLot.Text.Trim(), this.ddlExternalLot.SelectedValue);
                }
                return "";
            }
        }

        public string History
        {
            get
            {
                if (this.cbxHistory.Checked)
                {
                    return "Y";
                }
                return "N";
            }
        }

        public string Loaction
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLoaction.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLoaction.Text.Trim(), this.ddlLoaction.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute01
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute01.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute01.Text.Trim(), this.ddlLotAttribute01.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute02
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute02.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute02.Text.Trim(), this.ddlLotAttribute02.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute03
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute03.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute03.Text.Trim(), this.ddlLotAttribute03.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute04
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute04.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute04.Text.Trim(), this.ddlLotAttribute04.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute05
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute05.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute05.Text.Trim(), this.ddlLotAttribute05.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute06
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute06.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute06.Text.Trim(), this.ddlLotAttribute06.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute07
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute07.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute07.Text.Trim(), this.ddlLotAttribute07.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute08
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute08.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute08.Text.Trim(), this.ddlLotAttribute08.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute09
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute09.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute09.Text.Trim(), this.ddlLotAttribute09.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttribute10
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttribute10.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttribute10.Text.Trim(), this.ddlLotAttribute10.SelectedValue);
                }
                return "";
            }
        }

        public string LotAttributeID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotAttributeID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotAttributeID.Text.Trim(), this.ddlLotAttributeID.SelectedValue);
                }
                return "";
            }
        }

        public string Lpn
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLpn.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLpn.Text.Trim(), this.ddlLpn.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string ProductDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtProductDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtProductDate.Text.Trim(), this.ddlProductDate.SelectedValue, this.txtProductDate2.Text.Trim(), "ProductDate");
                }
                return "";
            }
        }

        public string Qty
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtQty.Text.Trim()))
                {
                    return base.GetParamsString(this.txtQty.Text.Trim(), this.ddlQty.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptDate.Text.Trim(), this.ddlReceiptDate.SelectedValue, this.txtReceiptDate2.Text.Trim(), "ReceiptDate");
                }
                return "";
            }
        }

        public string Sku
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSku.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSku.Text.Trim(), this.ddlSku.SelectedValue);
                }
                return "";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string SkuDescr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuDescr.Text.Trim(), this.ddlSkuDescrOper.SelectedValue);
                }
                return "";
            }
        }

        public string SkuProperty
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCSkuProperty.ReturnValue))
                {
                    return base.GetParamsString(this.MSCSkuProperty.ReturnValue, this.ddlSkuPropertyOper.SelectedValue);
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }
    }
}

